package com.juno.cafenoa.menu;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapRegionDecoder;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.juno.cafenoa.R;
import com.juno.cafenoa.util.FileCache;

public class IntroduceMenuAlertView extends LinearLayout {
	private Context mContext;
	private ImageView mCoffeImg;
	private TextView mCoffeText;

	private MenuBasicItem menuBasicItem;

	public IntroduceMenuAlertView(Context context, MenuBasicItem menuBasicItem) {
		super(context);
		this.menuBasicItem = menuBasicItem;
		this.mContext = context;
		init();
	}

	private void init() {
		LayoutInflater inflater = (LayoutInflater) mContext
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.dialog_menu_introduce, this);

		mCoffeImg = (ImageView) findViewById(R.id.dialog_menu_img);
		mCoffeText = (TextView) findViewById(R.id.dialog_menu_text);
		Log.d("Cashe image",
				menuBasicItem
						.getImgUrl().replace("http://rouge3351.cafe24.com/image",
								mContext.getCacheDir().toString()));
		mCoffeImg.setImageBitmap(BitmapFactory.decodeFile(menuBasicItem
				.getImgUrl().replace("http://rouge3351.cafe24.com/image",
						mContext.getCacheDir().toString())));
		mCoffeText.setText(menuBasicItem.getProductName());
	}
}
